<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
{{assign var="title" value=$title|default:'留言'}}
{{assign var="app" value='message'}}
{{assign var="act" value='index'}}
{{assign var="table" value='message'}}
{{assign var="message_type" value='message_type'|C}}
{{assign var="td" value='11'}}
<title>{{$title}}管理 - {{'admin|admin_site_name'|C|default:'后台管理'}}</title>
{{include file="include/base.html"}}
{{include file="{{$smarty.const.PLUG}}chosen/chosen.html"}}
{{include file="{{$smarty.const.PLUG}}drag/drag.html"}}
{{assign var="message_status" value='message_status'|C}}
{{include file="{{$smarty.const.PLUG}}tip/tip.html"}}
</head>
<body>

{{include file="include/sidebar.html"}}

<div class="body_right">
	<div id="content">
	
	<div class="search">
	<form action="index.php" name='search' class="router" method="get">
		<input type="hidden" name="app" value="{{$app}}"/>
		<input type="hidden" name="item" value="{{$smarty.get.item}}"/>
		<ul class="bread">
			<li class="floatr">
			</li>
			<li>
				id：<input type="text" class="input-mini" name="id" value="{{$smarty.get.id}}" />
			</li>
			<li>
				查询时间：<input type="text" name="start_date" class="Wdate"  style='width:100px' value='{{$smarty.get.start_date}}' /> ~ <input type="text" name="end_date" class="Wdate" style='width:100px'  value='{{$smarty.get.end_date}}' />
			</li>
			<li>
				状态：
				<select name="status" class="chosen">
					<option {{if $smarty.get.status==''}}selected="true"{{/if}} value="">全部</option>
					{{if $message_status}}
					{{foreach from=$message_status item=val key=key}}
					<option value="{{$key}}" {{if $smarty.get.status==$key and $smarty.get.status!=''}}selected{{/if}}>{{$val}}</option>
					{{/foreach}}
					{{/if}}
				</select>
			</li>
			<li>
				<button type="submit" class="search btn btn-success"><i class="icon-search"></i>搜索</button>
				<a href="index.php?app={{$app}}&act={{$act}}{{if $smarty.get.item}}&item={{$smarty.get.item}}{{/if}}" class="a">清除</a>
			</li>
			<li class='floatr'>
				<button class="bat btn btn-success" type="button"><i class="icon-ok icon-white"></i>批量处理</button>
				<a class="btn btn-warning" target='_blank' href="index.php?app=message&act=export&item={{$smarty.get.item}}{{if $smarty.get.start_date}}&start_date={{$smarty.get.start_date}}{{/if}}{{if $smarty.get.end_date}}&end_date={{$smarty.get.end_date}}{{/if}}{{if $smarty.get.status!=''}}&status={{$smarty.get.status}}{{/if}}{{if $smarty.get.title}}&title={{$smarty.get.title}}{{/if}}{{if $smarty.get.id}}&id={{$smarty.get.id}}{{/if}}">导出Excel</a>
			</li>
		</ul>
	</form>
	</div>

	<form name='form' action="index.php?app={{$app}}" method="post">
	<input type="hidden" name="app" value="{{$app}}"/>
	<input type="hidden" name="act" value=""/>
	<input type="hidden" name="table" value="{{$table}}"/>
	<table class="table table-bordered tablest" date="{{'table='|cat:$table|cat:'&field=ordering'|encode}}" >
		<tr class="thead">
			<td colspan="{{$td}}">
				<div class="floatr">
					<a class="delete btn btn-danger" href="javascript:"><i class="icon-trash icon-white"></i>批量删除</a>
				</div>
				◆ {{$title}}管理 －＞ {{$title}}列表
			</td>
		</tr>
		{{if !$result.data}}
		<tr class="noline"><td colspan="{{$td}}" class="result_empty"></td></tr>
		{{else}}
		<tr class="ttitle">
			<th width="10"><label><input class="check_all" type="checkbox"/></label></th>
			<th width="40">ID</th>
			<th width="55">类型</th>
			<th width="">{{$title}}内容/回复内容</th>
			<th width="150">留言者/操作员</th>
			<th width="">联系方式</th>
			<th width="100">IP</th>
			<th width="120">留言时间/回复时间</th>
			<th width="55">状态</th>
			<th width="138">操作</th>
		</tr>
		<tbody>
			{{foreach from=$result.data item=val key=key}}
			<tr class="drag">
				{{*全选*}}<td><label><input name="check_id[]" class="check_id" value="{{$val.id}}" type="checkbox"/></label></td>
				{{*ID*}}<td>{{$val.id}}<input name="ids[]" value="{{$val.id}}" type="hidden"/></td>
				{{*标题*}}<td>{{$message_type[$val.item]}}</td>
				{{*内容*}}<td>{{$val.content|replace:"\r\n":'<br>'}}
				{{if $val.params.photos}}
				{{foreach from=$val.params.photos item=vvv key=kkk}}
				<a class="zoom" href="{{$vvv|photo}}"><img style="max-width:35px;max-height:35px;" src="{{$vvv|photo:35:35:true}}"/></a>
				{{/foreach}}
				{{/if}}
				</td>
				{{*留言者*}}<td><a title="UID：{{$val.member_id}}" href="index.php?app=member&act=detail&id={{$val.member_id}}&iframe=true" class="a iframe">{{$val.nickname|default:$val.username}}</a></td>
				<td>
				{{if $val.tel}}<p>手机：{{$val.tel}}</p>{{/if}}
				{{if $val.email}}<p>邮箱：{{$val.email}}</p>{{/if}}
				</td>
				{{*IP*}}<td>{{$val.ip}}</td>
				{{*留言时间*}}<td>{{$val.adddate}}</td>
				{{*状态*}}<td><span class="{{if $val.status==0}}red{{elseif $val.status==2}}green{{else}}blue{{/if}} {{if $val.params.remark}}tip{{/if}}" title="{{$val.params.remark}}">{{$message_status[$val.status]}} {{if $val.params.remark}}<i class="icon-tag"></i>{{/if}}</span></td>
				<td>
					<a width=700 height=300 href="index.php?app={{$app}}&act=process&id={{$val.id}}&item={{$smarty.request.item}}{{if $smarty.get.tpl}}&tpl={{$smarty.get.tpl}}{{/if}}&iframe=true" class="btn iframe"><i class="icon-edit"></i>处理</a>
					{{if !$val.reply}}<a height='300' width='600' href="index.php?app={{$app}}&act=reply&idid={{$val.id}}&iframe=true" class="btn iframe btn-success"><i class="icon-edit"></i>回复</a>{{/if}}
				</td>
			</tr>
			{{*回复*}}{{if $val.reply}}
			<tr class="drag">
				{{*全选*}}<td><label><input name="check_id[]" class="check_id" value="{{$val.reply.id}}" type="checkbox"/></label></td>
				{{*ID*}}<td>{{$val.reply.id}}<input name="ids[]" value="{{$val.reply.id}}" type="hidden"/></td>
				{{*标题*}}<td></td>
				{{*回复*}}<td><b style="color:green;">|_______&nbsp;回复：</b>{{$val.reply.content|replace:"\r\n":'<br>'}}</td>
				{{*留言者*}}<td>{{$val.reply.author}}</td>
				<td></td>
				{{*IP*}}<td>{{$val.reply.ip}}</td>
				{{*留言时间*}}<td>{{$val.reply.adddate}}</td>
				<td></td>
				<td></td>
			</tr>
			{{/if}}
			{{/foreach}}
			<tr class="noline ttitle">
				<td colspan="{{$td}}">
					<a class="check_all btn"><i class="icon-ok"></i>全选/反选</a>
				</td>
			</tr>
			<tr class="thead">
			  <td colspan="{{$td}}">
				{{include file="include/page.html"}}
			  </td>
			</tr>
		</tbody>
		{{/if}}
	</table>
	</form>
</div>
</div>
<script>
$(function(){
	$(".bat").click(function(){
		if($('.check_id:checked').length==0) { ui.alert("至少选择一条数据!"); return false; }
		var url = "{{'index.php?app=message&act=bat&iframe=true'|URL}}";
		var ids = "";  
		$('.check_id:checked').each(function(i){
			ids += (","+$(this).val());
	    });
		ids = ids.substring(1);
		url = url +"?ids="+ids;
		$.colorbox({
			iframe:true,
			href:url,
			title:'编辑推荐',
			opacity:'0.3',
			overlayClose:false,
			width:500,
			height:200,
			maxHeight:'95%',
			maxWidth:'95%',
			fixed:true
		});
	});
});
</script>
</body>
</html>